

import 'package:alip_app/AppStates/NetworkApi.dart';
import 'package:alip_app/AppStates/TopicState.dart';
import 'package:alip_app/AppStates/UserState.dart';
import 'package:alip_app/StateManagement/ModelProvider.dart';
import 'package:alip_app/UI/Pages/MainPage.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(_initializeServiceProviders());
}
Widget _initializeUI() {
  return MaterialApp(
    home: MainPage(),
    darkTheme: ThemeData(
      primaryColor: Colors.blue.withOpacity(0.7),
      backgroundColor: Color(0x55444444),
      textTheme: TextTheme(
        headline4: TextStyle(
          color: Colors.blue.withOpacity(0.7),
          fontFamily: "ukij-bom",
          fontWeight: FontWeight.bold,
        ),
        bodyText2: TextStyle(color: Colors.white.withOpacity(0.8)),
        subtitle2: TextStyle(
          color: Colors.white.withOpacity(0.7),
          fontSize: 12.0,
        ),
        headline6: TextStyle(
          color: Colors.blue.withOpacity(0.7),
          fontWeight: FontWeight.bold,
          fontSize: 16.0,
        ),
      ),
      platform: TargetPlatform.iOS,
      fontFamily: "ukij-cjk",
      scaffoldBackgroundColor: Color(0xff282828),
      buttonTheme: ButtonThemeData(
          buttonColor: Colors.black.withOpacity(0.02),
        highlightColor: Colors.red
      ),
      hintColor: Colors.white,
    ),
    theme: ThemeData(
        textTheme: TextTheme(
          bodyText2: TextStyle(color: Colors.black.withOpacity(0.7)),
          subtitle2: TextStyle(
            color: Colors.black.withOpacity(0.4),
            fontSize: 12.0,
          ),
          headline6: TextStyle(
            color: Colors.blue,
            fontWeight: FontWeight.bold,
            fontSize: 16.0,
          )
        ),
        backgroundColor: Colors.black.withOpacity(0.02),
        platform: TargetPlatform.iOS,
        fontFamily: "ukij-cjk",
        scaffoldBackgroundColor: Colors.white,
        buttonTheme: ButtonThemeData(
            buttonColor: Colors.white.withOpacity(0.02)
        )
    ),
  );
}
Widget _initializeServiceProviders() {
  Widget buildingWidget;
  buildingWidget = _initializeUI();
  buildingWidget = ModelProvider<NetworkApi>(
    child: buildingWidget,
    model: NetworkApi(
      baseApiUrl: "https://aliptori.com"
    ),
  );
  buildingWidget = ModelProvider<TopicState>(
    child: buildingWidget,
    model: TopicState(),
  );
  buildingWidget = ModelProvider<UserState>(
    child: buildingWidget,
    model: UserState(),
  );
  return buildingWidget;
}